
import { ElMessage, ElMessageBox } from "element-plus";
export let $msg_s = (message, duration = 2000) => {
  ElMessage({
    showClose: true,
    message,
    duration,
    type: "success",
  });
};


export let $msg_w = (message, duration = 2000) => {
  ElMessage({
    showClose: true,
    message,
    duration,
    type: "warning",
  });
};


export let $msg_e = (message, duration = 2000) => {
  ElMessage({
    showClose: true,
    message,
    duration,
    type: "error",
  });
};


export let $confirm = (message, title = "提示", type = "warning") => {
  return new Promise((resolve, reject) => {
    ElMessageBox.confirm(message, title, {
      confirmButtonText: "确定",
      cancelButtonText: "取消",
      type,
    })
      .then(() => {
        resolve();
      })
      .catch(() => {
      });
  });
};
